<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="zh-cn">
    <head>
        <!-- Bootstrap -->
        <include file="Include/css" />
        <title>中经汇通</title>
        <link href="__STATICS__/css/admin/index.css" rel="stylesheet">
        <link href="__STATICS__/css/sweet-alert.css" rel="stylesheet">
        <link rel="stylesheet" href="__STATICS__/css/jquery-ui-date.min.css"/>
        <link rel="stylesheet" href="__STATICS__/css/jquery-ui-date.theme.min.css"/>
        
        <script type="text/javascript" src="__STATICS__/js/sweet-alert.min.js"></script>

    </head>
    <body>
        <include file="Include/nav_top" />
        <div class="container clearfix" id="left_menu_wraper" >
            <include  file="Include/menu_left" />
            <div id="right-content">
                <div id="right-content-inner">
                    <ul class="breadcrumb">
                        <span>您的位置：</span>
                        <li><a href="{:U('Houtai/Index/index')}">首页</a> </li>
                        <li class="">订单管理</li>
                        <li class="active">商场订单列表</li>
                    </ul>
                    <div role="tabpanel">
                        
                        <div class="row clearfix margin10 form-horizontal">
                            <form  name="query" >
                                <span class="pull-left ml30 form_bar">查询：</span>
                                <div class="col-md-3">
                                    <input type="text" name="orderSn" value="{$Think.request.orderSn}" placeholder=" 订单编号" class="pull-left ml10 form-control" />
                                </div>
                                <div class="col-md-2">
                                    <input type="text" name="userPhone" value="{$Think.request.userPhone}" placeholder=" 账号(手机号)" class="pull-left ml10 form-control" />
                                </div>
                                <div class="col-md-2">
                                    <input type="text" name="consignee" value="{$Think.request.consignee}" placeholder=" 收货人" class="pull-left ml10 form-control" />
                                </div>
                                <div class="col-md-3">
                                    <input type="text" name="liushui" value="{$Think.request.liushui}" placeholder=" 支付流水号" class="pull-left ml10 form-control" />
                                </div>
                                <div class="col-md-2">
                                    <select  name="sLogisticsStatus" class="pull-left ml10 form-control" >
                                            <option value="-1" <eq name="Think.request.sLogisticsStatus" value="-1" > selected </eq> >-配送状态-</option>
                                            <option value="0" <eq name="Think.request.sLogisticsStatus" value="0" > selected </eq> >未配送</option>
                                            <option value="1" <eq name="Think.request.sLogisticsStatus" value="1" > selected </eq> >已配送</option>
                                    </select>
                                </div>
                                <div class="col-md-2">
                                    <select  name="sStatus" class="pull-left ml10 form-control" >
                                            <option value="-1" <eq name="Think.request.sStatus" value="-1" > selected </eq> >-状态-</option>
                                            <option value="0" <eq name="Think.request.sStatus" value="0" > selected </eq> >未付款</option>
                                            <option value="1" <eq name="Think.request.sStatus" value="1" > selected </eq> >已付款</option>
                                            <option value="2" <eq name="Think.request.sStatus" value="2" > selected </eq> >已完成</option>
                                            <option value="3" <eq name="Think.request.sStatus" value="3" > selected </eq> >已取消</option>
                                    </select>
                                </div>
                                <div style="clear: both; margin: 10px 0px;"></div>
                                <span class="pull-left ml30 form_bar">付款时间：</span>
                                <div class="col-md-3">
                                    <input type="text" name="startPayTime" value="{$Think.request.startPayTime}" class="datepicker form-control" />
                                </div>
                                <div class="col-md-3">
                                    <input type="text" name="endPayTime" value="{$Think.request.endPayTime}" class="datepicker form-control" />
                                </div>
                                <div style="clear: both; margin: 10px 0px;"></div>
                                
                                <span class="pull-left ml30 form_bar">订单时间：</span>
                                <div class="col-md-3">
                                    <input type="text" name="startAddTime" value="{$Think.request.startAddTime}" class="datepicker form-control" />
                                </div>
                                <div class="col-md-3">
                                    <input type="text" name="endAddTime" value="{$Think.request.endAddTime}" class="datepicker form-control" />
                                </div>
                                <input type="hidden" name="p" value="1" />
                                <button type="submit" class="pull-left btn btn-default ml20">
                                    搜索
                                </button>
                            </form>
                            <div class="pull-right">
                                    <button id="export_excel" class="pull-left btn btn-orange ml20">
                                        导出
                                    </button>
                                </div>
                        </div>

                        <table class="table table-striped table_qrcode">
                            <!--<caption>标题</caption>-->
                            <thead>
                                <tr class="border">
                                    <th>订单号</th>
                                    <th>账号(手机号)</th>
                                    <th>物流单</th>
                                    <th>商品名称</th>
                                    <th>件数</th>
                                    <th>支付流水号</th>
                                    <th>收货人</th>
                                    <th>手机号</th>
                                    <th>省</th>
                                    <th>市</th>
                                    <th>区/县</th>
                                    <th>地址</th>
                                    <th>总价</th>
                                    <th>应付</th>
                                    <th>状态</th>
                                    <th>支付</th>
                                    <th>订单时间</th>
                                    <th>付款时间</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                <volist name="list" id="vo">
                                    <tr class="qr_tar" data-id="{$vo.orderID}"
                                    	data-orderSn="{$vo.orderSn}"
                                    	data-logis="{$vo.logisticsNo}" data-logisstatus="{$vo.logisticsStatus}"
                                    >
                                        <td>{$vo.orderSn}</td>
                                        <td>{$vo.userPhone}</td>
                                        <td>
                                        <a href="javascript:void(0);" id="logis_{$vo.orderID}" 
                                          class="edit_logis" title="点击可编辑物流单号" >
                                        	<empty name="vo['logisticsNo']">
												无
											<else />
                                        		{$vo.logisticsNo}
											</empty>
											
                                        </a>
                                        
                                        </td>
                                        <td>
                                            <volist name="vo.goodsList" id="vo1" >
                                                {$vo1.goodsName}
                                            </volist>
                                        </td>
                                        <td>{$vo.numOfPack}</td>
                                        <td><if condition="$vo['liushui'] gt 0" >
                                            {$vo.liushui}
                                            <else />
                                            无
                                            </if></td>
                                        <td>{$vo.consignee}</td>
                                        <td>{$vo.phone}</td>
                                        <td>{$vo.province}</td>
                                        <td>{$vo.city}</td>
                                        <td>{$vo.district}</td>
                                        <td>{$vo.address}</td>
                                        <td>{$vo.totalPrice}</td>
                                        <td>{$vo.payPrice}</td>
                                        <td class="">
                                            <switch name="vo.status" >
                                                <case value="0"><span class="text-warning"> 未付款</span></case>
                                                <case value="1"><span class="text-blue ">已付款</span></case>
                                                <case value="2"><span class="text-success ">已完成</span></case>
                                                <case value="3"><span class="text-danger">已取消</span></case>
                                            </switch>
                                            <switch name="vo['logisticsStatus']">
                                                <case value="0">/<span class="text-warning"> 未配送</span></case>
                                                <case value="1">/<span class="text-success"> 已配送</span></case>
                                                <default />
                                            </switch>
                                        </td>
                                        <td>{$vo.payModeName}</td>
                                        <td>{$vo.addTime|date="Y/m/d H:i:s",###} </td>  
                                        <td><if condition="$vo['payTime'] gt 0" >
                                            {$vo.payTime|date="Y/m/d H:i:s",###} 
                                            <else />
                                            无
                                            </if>
                                        </td>
                                        <td>
                                            <a href="javascript:void(0)" class="edit_look" title="可编辑订单信息"  >查看</a>
                                        </td>
                                    </tr>
                                </volist>
                            </tbody>
                        </table>

                        <div class="clearfix s_page pull-right">
                            {$page}
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
        <!-- Modal -->
        <div class="modal fade" id="myModal_logis" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog modal-lg">
                <div class="modal-content ">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="myModalLabel_logis"> </h4>
                    </div>
                    <div class="modal-body">
                    	<div class="clearfix">
                    		<div class="col-md-12 margin10">
                                    <div class="col-md-3 text_right form_bar">
                                        	物流单号：
                                    </div>
                                    <div class="col-md-6">
                                        <input type="text" id="logisNo" class="form-control" />
                                    </div>
                             </div>
                    		<div class="col-md-12 margin10">
                                    <div class="col-md-3 text_right form_bar">
                                        	是否已配送：
                                    </div>
                                    <div class="col-md-6">
                                        <div class="btn-group clearfix" data-toggle="buttons">
                                             <label class="btn btn-warning" >
                                                 <input name="logisStatus" type="radio" utocomplete="off" value="1"> YES
                                             </label>
                                             <label class="btn btn-warning ">
                                                 <input name="logisStatus" type="radio" autocomplete="off" value="0"> NO
                                             </label>
                                         </div>
                                    </div>
                             </div>
                    	</div>
                    
        			</div>
                    <div class="modal-footer">
                    <input type="hidden" id="logis_orderID" />
                        <a href="javascript:void(0);" class="btn btn-default" data-dismiss="modal">取消</a>
                        <a href="javascript:void(0);" class="btn btn-primary" id="save_logis" >保存</a>
                    </div>
                </div>
            </div>
        </div>

        <!-- Modal -->
        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog modal-lg">
                <div class="modal-content ">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="myModalLabel"> </h4>
                    </div>
                    <div class="modal-body">
                        
                        <div class="clearfix">
                                <div class="col-md-12 margin10">
                                    <div class="col-md-3 text_right form_bar">
                                        下单时间：
                                    </div>
                                    <div class="col-md-6">
                                        <span id="addTime"></span>
                                    </div>
                                </div>
                                <div class="col-md-12 margin10">
                                    <div class="col-md-3 text_right form_bar">
                                        订单编号：
                                    </div>
                                    <div class="col-md-6">
                                        <span id="orderSn"></span>
                                    </div>
                                </div>
                                <div class="col-md-12 margin10">
                                    <div class="col-md-3 text_right form_bar">
                                       商品：
                                    </div>
                                    <div class="col-md-6">
                                        <span id="goodsName"></span>
                                    </div>
                                </div>
                                <div class="col-md-12 margin10">
                                    <div class="col-md-3 text_right form_bar">
                                        优惠券：
                                    </div>
                                    <div class="col-md-6">
                                        <span id="couponName"></span>
                                    </div>
                                </div>
                                <div class="col-md-12 margin10">
                                    <div class="col-md-3 text_right form_bar">
                                        收货人：
                                    </div>
                                    <div class="col-md-6">
                                        <input id="linkMan" class="form-control" />
                                    </div>
                                </div>
                                <div class="col-md-12 margin10">
                                    <div class="col-md-3 text_right form_bar">
                                        收货手机号：
                                    </div>
                                    <div class="col-md-6">
                                        <input id="linkPhone" class="form-control" />
                                    </div>
                                </div>
                                <div class="col-md-12 margin10">
                                    <div class="col-md-3 text_right form_bar">
                                        收货地址：
                                    </div>
                                    <div class="col-md-6">
                                        <input id="linkAddr" class="form-control" />
                                    </div>
                                </div>   
                                
                                <div class="col-md-12 margin10">
                                    <div class="col-md-3 text_right form_bar">
                                        商店名称：
                                    </div>
                                    <div class="col-md-6">
                                        <span id="shopName"></span>
                                    </div>
                                </div>                         
                                <div class="col-md-12 margin10">
                                    <div class="col-md-3 text_right form_bar">
                                         商店地址：
                                    </div>
                                    <div class="col-md-6">
                                        <span id="address"></span>
                                    </div>
                                </div>    
                            
                                <div class="col-md-12 margin10">
                                    <div class="col-md-3 text_right form_bar">
                                        订单总价：
                                    </div>
                                    <div class="col-md-4">
                                        <div class="form-group">
                                            <label class="sr-only" for="exampleInputAmount">订单总价 (in dollars)</label>
                                            <div class="input-group">
                                              <div class="input-group-addon">￥</div>
                                              <input type="text" class="form-control" id="totalPrice" placeholder="总价价钱">
                                              <div class="input-group-addon">元</div>
                                            </div>
                                          </div>
                                    </div>
                                </div>
                                <div class="col-md-12 margin10">
                                    <div class="col-md-3 text_right form_bar">
                                        应付价格：
                                    </div>
                                    <div class="col-md-4">
                                    	<div class="form-group">
                                            <label class="sr-only" for="exampleInputAmount">订单总价 (in dollars)</label>
                                            <div class="input-group">
                                              <div class="input-group-addon">￥</div>
                                              <input type="text" class="form-control" id="payPrice" placeholder="应付价钱">
                                              <div class="input-group-addon">元</div>
                                            </div>
                                          </div>
                                    </div>
                                </div>
                                <div class="col-md-12 margin10">
                                    <div class="col-md-3 text_right form_bar">
                                        下订备注：
                                    </div>
                                    <div class="col-md-8">
                                        <span id="remark"></span>
                                    </div>
                                </div>
                                
                               <div class="col-md-12 margin10">
                                    <div class="col-md-3 text_right form_bar">
                                        	物流单号：
                                    </div>
                                    <div class="col-md-6">
                                        <input type="text" id="logisticsNo" class="form-control" />
                                    </div>
                             </div>
                    		<div class="col-md-12 margin10">
                                    <div class="col-md-3 text_right form_bar">
                                        	是否已配送：
                                    </div>
                                    <div class="col-md-6">
                                        <div class="btn-group clearfix" data-toggle="buttons">
                                             <label class="btn btn-warning" >
                                                 <input name="logisticsStatus" type="radio" utocomplete="off" value="1"> YES
                                             </label>
                                             <label class="btn btn-warning ">
                                                 <input name="logisticsStatus" type="radio" autocomplete="off" value="0"> NO
                                             </label>
                                         </div>
                                    </div>
                             </div>
                                
                                <div class="col-md-12 margin10">
                                    <div class="col-md-3 text_right form_bar">
                                        是否已评论：
                                    </div>
                                    <div class="col-md-6">
                                        <span id="isComment"></span>
                                    </div>
                                </div>
                                <div class="col-md-12 margin10">
                                    <div class="col-md-3 text_right form_bar">
                                        支付方式名称：
                                    </div>
                                    <div class="col-md-6">
                                        <span id="payModeName"></span>
                                    </div>
                                </div>
                                <div class="col-md-12 margin10">
                                    <div class="col-md-3 text_right form_bar">
                                        支付时间：
                                    </div>
                                    <div class="col-md-6">
                                        <span id="payTime"></span>
                                    </div>
                                </div>
                                <div class="col-md-12 margin10">
                                    <div class="col-md-3 text_right form_bar">
                                        订单完成时间：
                                    </div>
                                    <div class="col-md-6">
                                        <span id="dealTime"></span>
                                    </div>
                                </div>
                                
                                <div class="col-md-12 margin10">
                                    <div class="col-md-3 text_right form_bar">
                                        处理订单：
                                    </div>
                                    <div class="col-md-8">
                                        <button type="button" class="btn btn-default " id="cancelOrder" >取消订单</button>
                                        <button type="button" class="btn btn-default" id="dealOrder" >完成订单</button>
                                    </div>
                                </div>
                                <div class="col-md-12 margin10">
                                    <div class="col-md-3 text_right form_bar">
                                        备注：
                                    </div>
                                    <div class="col-md-6">
                                        <textarea id="mRemark" class="form-control" ></textarea>
                                    </div>
                                </div>
                                <input id="orderID" type="hidden" />
                                
                            </div>
                        
                    </div>
                    <div class="modal-footer">
                        <a href="javascript:void(0);" class="btn btn-default" data-dismiss="modal">取消</a>
                        <a href="javascript:void(0);" class="btn btn-primary" id="save" >保存</a>
                    </div>
                </div>
            </div>
        </div>

        <include file="Include/script" />
        <script src="__STATICS__/js/jquery-ui-date.min.js"></script>
        
        <script>
            var reload = false;
            var img_url = "__STATICS__/images";

            /*更新物流单号之后*/
            function onUpdateLogis(rsp) {
            	
            	if(rsp.result > 0) {
            		window.location.reload(true);
            	} else {
            		swal('操作失败;' + rsp.desc,'','warning');
            	}
            }
            
            function checkVal() {
            	var rt = true;
            	
                var linkMan = $.trim($("#linkMan").val());
                var  linkPhone= $.trim($("#linkPhone").val());
                var  linkAddr= $.trim($("#linkAddr").val());
                var logisticsNo = $.trim($("#logisticsNo").val());
                var logisticsStatus = $(":radio[name='logisticsStatus']:checked").val(); /*物流状态*/
                var totalPrice =  $("#totalPrice").val();
                var  payPrice= $("#payPrice").val();
                var  mRemark=  $("#mRemark").val();
                
                if (linkMan.length == 0) {
                    rt = false;
                    msg = "联系人不能为空";
                    $("#linkMan").focus();
                }else if (linkPhone.length == 0) {
                    rt = false;
                    msg = "联系电话不能为空";
                    $("#linkPhone").focus();
                } else if (linkAddr.length == 0) {
                    rt = false;
                    msg = "收货地址不能为空";
                    $("#linkAddr").focus();
                } else if (logisticsStatus == 1 && logisticsNo.length == 0 ) {
                    rt = false;
                    msg = "请输入物流单号";
                    $("#logisticsNo").focus();
                } else if (isNaN(parseInt(totalPrice))) {
                    rt = false;
                    msg = "请输入正确的总价";
                    $("#totalPrice").focus();
                } else if (isNaN(parseInt(payPrice))) {
                    rt = false;
                    msg = "请输入正确的应付价格";
                    $("#payPrice").focus();
                } 
                if(!rt) {
                    swal(msg,'','warning');
               }
               
               return rt;
            }

            /*查看订单详情后*/
            function onEdit(rsp) {
            	
                if(rsp.result > 0) {
                	
                   $("#orderID").val(rsp.info.orderID);
                   $("#orderSn").html(rsp.info.orderSn);
                   $("#linkMan").val(rsp.info.linkMan);
                   $("#linkPhone").val(rsp.info.linkPhone);
                   $("#linkAddr").val(rsp.info.linkAddr);
                   $("#logisticsNo").val(rsp.info.logisticsNo);
                   var logisticsStatus = rsp.info.logisticsStatus;
					
                    $(":radio[name='logisticsStatus']").each(function(){
                        if($(this).val() == logisticsStatus) $(this).click();
                   }); /*物流状态*/
                    
                    $("#shopName").html(rsp.info.shopName);
                    $("#address").html(rsp.info.address);
                    $("#totalPrice").val(rsp.info.totalPrice);
                    $("#payPrice").val(rsp.info.payPrice);
                    $("#mRemark").val(rsp.info.mRemark);
                    $("#remark").html(rsp.info.remark);
                    $("#statusStr").html(rsp.info.statusStr); /*订单状态*/
                    $("#isComment").html(rsp.info.isComment); /*评论状态*/
                    // $("#payModeID").val(rsp.info.payModeID); /*支付方式ID*/
                    $("#payModeName").html(rsp.info.payModeName);
                    $("#payTime").html(rsp.info.payTime);
                    $("#dealTime").html(rsp.info.dealTime);
                    $("#addTime").html(rsp.info.addTime);
                    
                    
                    var goodsArr = rsp.goods;
//                    console.log(goodsArr);
                    if(goodsArr){
                            var goodsStr = [];
                            for(var i=0;i<goodsArr.length;i++){
                                 goodsStr.push(goodsArr[i].goodsName);
                         }
                         $("#goodsName").html(goodsStr.join('，'));
                    }  
                    
                    var couponArr = rsp.coupon;
//                    console.log(couponArr);     
                    if(couponArr){
                            var couponStr = [];
                            for(var i=0;i<couponArr.length;i++){
                                couponStr.push(couponArr[i].couponName);
                            }
                        $("#couponName").html(couponStr.join('，'));
                    } else {
                        $("#couponName").html('无');
                    }
                    
                    if(rsp.info.status == 1 ||rsp.info.status == 2 || rsp.info.status == 3 ) { // 不可取消
                        $("#cancelOrder").attr("disabled",true);
                    } else { // 可取消
                         $("#cancelOrder").attr("disabled",false);
                    }
                    
                    if(rsp.info.status == 0 || rsp.info.status == 2 || rsp.info.status == 3) { // 不可完成
                        $("#dealOrder").attr("disabled",true);
                    } else { // 可完成
                         $("#dealOrder").attr("disabled",false);
                    }
                    
                    $("#myModalLabel").html("订单详情 (" + rsp.info.orderSn + "  "  + rsp.info.statusStr + " / " + rsp.info.logisticsStatusStr + "  / "  + rsp.info.isComment + ") ");
                    $('#myModal').modal(); // 跳出弹窗
                    
                } else {
                	swal('操作失败;' + rsp.desc,'','warning');
                }
            }
            
			/*更新订单状态*/
            function updateStatus(status) {
                var jsonData = {};
                jsonData.orderID = $("#orderID").val();
                jsonData.status = status;
                
                ajax_go_1(jsonData,"{:U('CNEPAdmin/Order/updateStatus')}",onUpdate);
            }
            
			/*更新订单状态后*/
            function onUpdate(rsp) {
                if(rsp.result > 0) {
                    swal("操作成功",'','success');
                    reload = true;
                    // window.location.reload();
                } else {
                    swal("操作失败："+rsp.desc,'','warning');
                    reload = false;
                }
            }
            
            /*清空弹出框内容*/
            function reset_display()
            {
            	$("#orderID").val('');
                $("#orderSn").html('');
                $("#linkMan").val('');
                $("#linkPhone").val('');
                $("#address").val('' );
                $("#logisticsNo").val('' );
                 
                 $("#shopName").html('');
                 $("#shopAddr").html('');
                 $("#totalPrice").val('');
                 $("#payPrice").val('');
                 $("#mRemark").val('');
                 $("#remark").html('');
                 $("#statusStr").html( ''); /*订单状态*/
                 $("#isComment").html( ''); /*评论状态*/
                 // $("#payModeID").val(rsp.info.payModeID); /*支付方式ID*/
                 $("#payModeName").html( '');
                 $("#payTime").html( '' );
                 $("#dealTime").html( '');
                 $("#addTime").html( '');

            }
			
            $(function () {
            	/*菜单展开及高亮*/
            	$('.order').addClass('open');
                $('#order2').addClass('active');

                $('.datepicker').datepicker();

                /*订单详情弹框关闭之后*/
                $('#myModal').on('hidden.bs.modal', function (e) {
                	
                	if(reload) {
                		window.location.reload();
                	}
                    reset_display();
                 });
                /*物流弹框关闭之后*/
                $('#myModal_logis').on('hidden.bs.modal', function (e) {

                	if(reload) {
                		window.location.reload();
                	}
                    reset_display();
            	 });
                
                /*点击编辑物流单号*/
                $(".edit_logis").on("click", function () {
                    var orderID = $(this).closest("tr").attr("data-id");
                    var orderSn = $(this).closest("tr").attr("data-orderSn");
                    var logisticsNo = $(this).closest("tr").attr("data-logis");
                    var logisticsStatus = $(this).closest("tr").attr("data-logisstatus");
					
                    $(":radio[name='logisStatus']").each(function(){
                        if($(this).val() == logisticsStatus) $(this).click();
                   });
                    var str = '【 订单号：' + orderSn + ' （未配送）】';
                    
                    switch(logisticsStatus) {
                    	case 1:
                    		str = '【 订单号：' + orderSn + ' （已配送）】';
                    		break;
                    	
                    }
                    
                    $("#logisNo").val(logisticsNo);
                    $("#logis_orderID").val(orderID);
                    $("#myModalLabel_logis").html("编辑物流单" + str );
                    $('#myModal_logis').modal(); // 跳出弹窗
                    
                });
                
                /*点击保存物流单号*/
                $("#save_logis").on('click',function() {
                	var jsonData = {};
                	jsonData.orderID = $("#logis_orderID").val();
            		jsonData.logis = $("#logisNo").val();
            		jsonData.logisStatus = $(":radio[name='logisStatus']:checked").val(); /*物流状态*/
            		
                    ajax_go_1(jsonData,"{:U('CNEPAdmin/Order/updateLogisticsNo')}",onUpdateLogis);
                	
                });
                
				/*点击查看订单*/
                $(".edit_look").on("click", function () {
                    var orderID = $(this).closest("tr").attr("data-id");
                    var jsonData = {};
                    jsonData.orderID = orderID;
                    ajax_go_1(jsonData,"{:U('CNEPAdmin/Order/orderMsg')}",onEdit);
                    
                });
				
				/*点击保存订单详情*/
                $("#save").on("click",function() {
                	
                	if(checkVal()) {
                		var orderID = $("#orderID").val();
	                    var jsonData = {};
	                    jsonData.orderID = orderID;
                		jsonData.linkMan = $.trim($("#linkMan").val());
                		jsonData.linkPhone= $.trim($("#linkPhone").val());
                		jsonData.linkAddr= $.trim($("#linkAddr").val());
                		jsonData.logisticsNo = $.trim($("#logisticsNo").val());
                		jsonData.logisticsStatus = $(":radio[name='logisticsStatus']:checked").val(); /*物流状态*/
                		jsonData.totalPrice =  $("#totalPrice").val();
                		jsonData.payPrice= $("#payPrice").val();
                		jsonData.mRemark=  $("#mRemark").val();

	                    ajax_go_1(jsonData,"{:U('CNEPAdmin/Order/updateOrderMsg')}",onUpdate);
                	}
                	
                });
                
                /*完成订单*/
                $("#dealOrder").on("click", function () {
                    
                    var self = $(this);
                    swal({      title: "您确定吗?",
                                text: "您将处理此订单！",
                                type: "warning",
                                showCancelButton: true,
                                confirmButtonColor: "#DD6B55",
                                confirmButtonText: "是的，处理",
                                cancelButtonText: "放弃",
                                closeOnConfirm: false
                            },
                            function (isConfirm) {
                                if (isConfirm) {
                                     updateStatus(2);
                                }
                            });
                });
                
                /*取消订单*/
                $("#cancelOrder").on("click", function () {
                    
                        var self = $(this);
                        swal({   title: "您确定吗?",
                                    text: "您将处理此订单！",
                                    type: "warning",
                                    showCancelButton: true,
                                    confirmButtonColor: "#DD6B55",
                                    confirmButtonText: "是的，处理",
                                    cancelButtonText: "放弃",
                                    closeOnConfirm: false
                                },
                                function (isConfirm) {
                                    if (isConfirm) {
                                        
                                         updateStatus(3);
                                    }

                                });
                });
                
                /*取消订单*/
                $("#export_excel").on("click", function () {
                    
                        var self = $(this);
                        swal({   title: "您确定吗?",
                                    text: "您将导出Excel表单！",
                                    type: "warning",
                                    showCancelButton: true,
                                    confirmButtonColor: "#DD6B55",
                                    confirmButtonText: "是的",
                                    cancelButtonText: "放弃",
                                    closeOnConfirm: true
                                },
                                function (isConfirm) {
                                    if (isConfirm) {
                                        var param = "orderSn={$Think.request.orderSn}&liushui={$Think.request.liushui}&userPhone={$Think.request.userPhone}&sLogisticsStatus={$Think.request.sLogisticsStatus}&sStatus={$Think.request.sStatus}&startPayTime={$Think.request.startPayTime}&endPayTime={$Think.request.endPayTime}&startAddTime={$Think.request.startAddTime}&endAddTime={$Think.request.endAddTime}&consignee={$Think.request.consignee}";
                                        window.location.href = "{:U('CNEPAdmin/Excel/orderReport')}?sOrderType={$Think.request.sOrderType}&"+param;
                                    }

                                });
                });
                                
                });   
           
        </script>
    </body>
</html>